import React from 'react'
import {connect} from 'react-redux'
import {bindActionCreators} from 'redux'

import * as counterActions from '../store/actions/counterActions'

function Counter (props) {
  console.log(props, '11111')
  return (
    <div>
      <button onClick={props.increament}>+1</button>
      <button onClick={() => { props.increament5(5) }}>+5</button>
       {props.count}
       <button onClick={props.decreament}>-1</button>
    </div>
  )
}

const mapDispatchToProps = dispatch => ({
  ...bindActionCreators(counterActions, dispatch)
})

const mapStateToProps = state => ({
  count: state.counter.count
})

export default connect(mapStateToProps, mapDispatchToProps)(Counter)